<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QVariantAnimation Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QVariantAnimation Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QVariantAnimation class provides an abstract base class for
animations. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractanimation.html">QAbstractAnimation</a>.</p><p>Inherited by <a href="qpropertyanimation.html">QPropertyAnimation</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qvariantanimation.html#QVariantAnimation">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />QVariant <b><a href="qvariantanimation.html#currentValue">currentValue</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qvariantanimation.html#duration">duration</a></b> (<i>self</i>)</li><li><div class="fn" />QEasingCurve <b><a href="qvariantanimation.html#easingCurve">easingCurve</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant <b><a href="qvariantanimation.html#endValue">endValue</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qvariantanimation.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>event</i>)</li><li><div class="fn" />QVariant <b><a href="qvariantanimation.html#interpolated">interpolated</a></b> (<i>self</i>, QVariant&#160;<i>from</i>, QVariant&#160;<i>to</i>, float&#160;<i>progress</i>)</li><li><div class="fn" />QVariant <b><a href="qvariantanimation.html#keyValueAt">keyValueAt</a></b> (<i>self</i>, float&#160;<i>step</i>)</li><li><div class="fn" />list-of-tuple-of-float-QVariant <b><a href="qvariantanimation.html#keyValues">keyValues</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qvariantanimation.html#setDuration">setDuration</a></b> (<i>self</i>, int&#160;<i>msecs</i>)</li><li><div class="fn" /><b><a href="qvariantanimation.html#setEasingCurve">setEasingCurve</a></b> (<i>self</i>, QEasingCurve&#160;<i>easing</i>)</li><li><div class="fn" /><b><a href="qvariantanimation.html#setEndValue">setEndValue</a></b> (<i>self</i>, QVariant&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qvariantanimation.html#setKeyValueAt">setKeyValueAt</a></b> (<i>self</i>, float&#160;<i>step</i>, QVariant&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qvariantanimation.html#setKeyValues">setKeyValues</a></b> (<i>self</i>, list-of-tuple-of-float-QVariant&#160;<i>values</i>)</li><li><div class="fn" /><b><a href="qvariantanimation.html#setStartValue">setStartValue</a></b> (<i>self</i>, QVariant&#160;<i>value</i>)</li><li><div class="fn" />QVariant <b><a href="qvariantanimation.html#startValue">startValue</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qvariantanimation.html#updateCurrentTime">updateCurrentTime</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qvariantanimation.html#updateCurrentValue">updateCurrentValue</a></b> (<i>self</i>, QVariant&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qvariantanimation.html#updateState">updateState</a></b> (<i>self</i>, QAbstractAnimation.State&#160;<i>newState</i>, QAbstractAnimation.State&#160;<i>oldState</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qvariantanimation.html#valueChanged">valueChanged</a></b> (const QVariant&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QVariantAnimation class provides an abstract base class for
animations.</p>
<p>This class is part of <a href="animation-overview.html">The
Animation Framework</a>. It serves as a base class for property and
item animations, with functions for shared functionality.</p>
<p>QVariantAnimation cannot be used directly as it is an abstract
class; it has a pure virtual method called <a href="qvariantanimation.html#updateCurrentValue">updateCurrentValue</a>().
The class performs interpolation over <a href="qvariant.html">QVariant</a>s, but leaves using the interpolated
values to its subclasses. Currently, Qt provides <a href="qpropertyanimation.html">QPropertyAnimation</a>, which animates Qt
<a href="properties.html#qt-s-property-system">properties</a>. See
the <a href="qpropertyanimation.html">QPropertyAnimation</a> class
description if you wish to animate such properties.</p>
<p>You can then set start and end values for the property by
calling <a href="qvariantanimation.html#startValue-prop">setStartValue</a>() and
<a href="qvariantanimation.html#endValue-prop">setEndValue</a>(),
and finally call <a href="qabstractanimation.html#start">start</a>() to start the animation.
QVariantAnimation will interpolate the property of the target
object and emit <a href="qvariantanimation.html#valueChanged">valueChanged</a>(). To react
to a change in the current value you have to reimplement the
<a href="qvariantanimation.html#updateCurrentValue">updateCurrentValue</a>()
virtual function.</p>
<p>It is also possible to set values at specified steps situated
between the start and end value. The interpolation will then touch
these points at the specified steps. Note that the start and end
values are defined as the key values at 0.0 and 1.0.</p>
<p>There are two ways to affect how QVariantAnimation interpolates
the values. You can set an easing curve by calling <a href="qvariantanimation.html#easingCurve-prop">setEasingCurve</a>(), and
configure the duration by calling <a href="qvariantanimation.html#duration-prop">setDuration</a>(). You can
change how the <a href="qtwebkit-bridge.html#qvariants">QVariants</a> are interpolated by
creating a subclass of QVariantAnimation, and reimplementing the
virtual <a href="qvariantanimation.html#interpolated">interpolated</a>()
function.</p>
<p>Subclassing QVariantAnimation can be an alternative if you have
<a href="qvariant.html">QVariant</a>s that you do not wish to
declare as Qt properties. Note, however, that you in most cases
will be better off declaring your <a href="qvariant.html">QVariant</a> as a property.</p>
<p>Not all <a href="qvariant.html">QVariant</a> types are
supported. Below is a list of currently supported <a href="qvariant.html">QVariant</a> types:</p>
<ul>
<li><a href="qmetatype.html#Type-enum">Int</a></li>
<li><a href="qmetatype.html#Type-enum">Double</a></li>
<li><a href="qmetatype.html#Type-enum">Float</a></li>
<li><a href="qmetatype.html#Type-enum">QLine</a></li>
<li><a href="qmetatype.html#Type-enum">QLineF</a></li>
<li><a href="qmetatype.html#Type-enum">QPoint</a></li>
<li><a href="qmetatype.html#Type-enum">QPointF</a></li>
<li><a href="qmetatype.html#Type-enum">QSize</a></li>
<li><a href="qmetatype.html#Type-enum">QSizeF</a></li>
<li><a href="qmetatype.html#Type-enum">QRect</a></li>
<li><a href="qmetatype.html#Type-enum">QRectF</a></li>
<li><a href="qmetatype.html#Type-enum">QColor</a></li>
</ul>
<p>If you need to interpolate other variant types, including custom
types, you have to implement interpolation for these yourself. To
do this, you can register an interpolator function for a given
type. This function takes 3 parameters: the start value, the end
value and the current progress.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type"><a href="qvariant.html">QVariant</a></span> myColorInterpolator(<span class="keyword">const</span> <span class="type"><a href="qcolor.html">QColor</a></span> <span class="operator">&amp;</span>start<span class="operator">,</span> <span class="keyword">const</span> <span class="type"><a href="qcolor.html">QColor</a></span> <span class="operator">&amp;</span>end<span class="operator">,</span> <span class="type"><a href="qtcore.html#qreal-typedef">qreal</a></span> progress)
 {
     <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
     <span class="keyword">return</span> <span class="type"><a href="qcolor.html">QColor</a></span>(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>);
 }
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 <a href="qvariantanimation.html#qRegisterAnimationInterpolator">qRegisterAnimationInterpolator</a><span class="operator">&lt;</span><span class="type"><a href="qcolor.html">QColor</a></span><span class="operator">&gt;</span>(myColorInterpolator);
</pre>
<p>Another option is to reimplement <a href="qvariantanimation.html#interpolated">interpolated</a>(), which
returns interpolation values for the value being interpolated.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QVariantAnimation" />QVariantAnimation.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Construct a <a href="qvariantanimation.html">QVariantAnimation</a> object.
<i>parent</i> is passed to <a href="qabstractanimation.html">QAbstractAnimation</a>'s constructor.</p>


<h3 class="fn"><a name="currentValue" />QVariant QVariantAnimation.currentValue (<i>self</i>)</h3><h3 class="fn"><a name="duration" />int QVariantAnimation.duration (<i>self</i>)</h3><h3 class="fn"><a name="easingCurve" /><a href="qeasingcurve.html">QEasingCurve</a> QVariantAnimation.easingCurve (<i>self</i>)</h3><h3 class="fn"><a name="endValue" />QVariant QVariantAnimation.endValue (<i>self</i>)</h3><h3 class="fn"><a name="event" />bool QVariantAnimation.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="interpolated" />QVariant QVariantAnimation.interpolated (<i>self</i>, QVariant&#160;<i>from</i>, QVariant&#160;<i>to</i>, float&#160;<i>progress</i>)</h3><p>This virtual function returns the linear interpolation between
variants <i>from</i> and <i>to</i>, at <i>progress</i>, usually a
value between 0 and 1. You can reimplement this function in a
subclass of <a href="qvariantanimation.html">QVariantAnimation</a>
to provide your own interpolation algorithm.</p>
<p>Note that in order for the interpolation to work with a <a href="qeasingcurve.html">QEasingCurve</a> that return a value smaller
than 0 or larger than 1 (such as <a href="qeasingcurve.html#Type-enum">QEasingCurve.InBack</a>) you should
make sure that it can extrapolate. If the semantic of the datatype
does not allow extrapolation this function should handle that
gracefully.</p>
<p>You should call the <a href="qvariantanimation.html">QVariantAnimation</a> implementation of
this function if you want your class to handle the types already
supported by Qt (see class <a href="qvariantanimation.html">QVariantAnimation</a> description for a
list of supported types).</p>
<p><b>See also</b> <a href="qeasingcurve.html">QEasingCurve</a>.</p>


<h3 class="fn"><a name="keyValueAt" />QVariant QVariantAnimation.keyValueAt (<i>self</i>, float&#160;<i>step</i>)</h3><p>Returns the key frame value for the given <i>step</i>. The given
<i>step</i> must be in the range 0 to 1. If there is no <a href="qvariantanimation.html#KeyValue-typedef">KeyValue</a> for
<i>step</i>, it returns an invalid <a href="qvariant.html">QVariant</a>.</p>
<p><b>See also</b> <a href="qvariantanimation.html#keyValues">keyValues</a>() and <a href="qvariantanimation.html#setKeyValueAt">setKeyValueAt</a>().</p>


<h3 class="fn"><a name="keyValues" />list-of-tuple-of-float-QVariant QVariantAnimation.keyValues (<i>self</i>)</h3><p>Returns the key frames of this animation.</p>
<p><b>See also</b> <a href="qvariantanimation.html#keyValueAt">keyValueAt</a>() and <a href="qvariantanimation.html#setKeyValues">setKeyValues</a>().</p>


<h3 class="fn"><a name="setDuration" />QVariantAnimation.setDuration (<i>self</i>, int&#160;<i>msecs</i>)</h3><h3 class="fn"><a name="setEasingCurve" />QVariantAnimation.setEasingCurve (<i>self</i>, <a href="qeasingcurve.html">QEasingCurve</a>&#160;<i>easing</i>)</h3><h3 class="fn"><a name="setEndValue" />QVariantAnimation.setEndValue (<i>self</i>, QVariant&#160;<i>value</i>)</h3><h3 class="fn"><a name="setKeyValueAt" />QVariantAnimation.setKeyValueAt (<i>self</i>, float&#160;<i>step</i>, QVariant&#160;<i>value</i>)</h3><p>Creates a key frame at the given <i>step</i> with the given
<i>value</i>. The given <i>step</i> must be in the range 0 to
1.</p>
<p><b>See also</b> <a href="qvariantanimation.html#setKeyValues">setKeyValues</a>() and
<a href="qvariantanimation.html#keyValueAt">keyValueAt</a>().</p>


<h3 class="fn"><a name="setKeyValues" />QVariantAnimation.setKeyValues (<i>self</i>, list-of-tuple-of-float-QVariant&#160;<i>values</i>)</h3><p>Replaces the current set of key frames with the given
<i>keyValues</i>. the step of the key frames must be in the range 0
to 1.</p>
<p><b>See also</b> <a href="qvariantanimation.html#keyValues">keyValues</a>() and <a href="qvariantanimation.html#keyValueAt">keyValueAt</a>().</p>


<h3 class="fn"><a name="setStartValue" />QVariantAnimation.setStartValue (<i>self</i>, QVariant&#160;<i>value</i>)</h3><h3 class="fn"><a name="startValue" />QVariant QVariantAnimation.startValue (<i>self</i>)</h3><h3 class="fn"><a name="updateCurrentTime" />QVariantAnimation.updateCurrentTime (<i>self</i>, int)</h3><p>Reimplemented from <a href="qabstractanimation.html#updateCurrentTime">QAbstractAnimation.updateCurrentTime</a>().</p>


<h3 class="fn"><a name="updateCurrentValue" />QVariantAnimation.updateCurrentValue (<i>self</i>, QVariant&#160;<i>value</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This pure virtual function is called every time the animation's
current value changes. The <i>value</i> argument is the new current
value.</p>
<p><b>See also</b> <a href="qvariantanimation.html#currentValue-prop">currentValue</a>.</p>


<h3 class="fn"><a name="updateState" />QVariantAnimation.updateState (<i>self</i>, <a href="qabstractanimation.html#State-enum">QAbstractAnimation.State</a>&#160;<i>newState</i>, <a href="qabstractanimation.html#State-enum">QAbstractAnimation.State</a>&#160;<i>oldState</i>)</h3><p>Reimplemented from <a href="qabstractanimation.html#updateState">QAbstractAnimation.updateState</a>().</p>


<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="valueChanged" />void valueChanged (const QVariant&amp;)</h3><p>This is the default overload of this signal.</p><p><a href="qvariantanimation.html">QVariantAnimation</a> emits
this signal whenever the current <i>value</i> changes.</p>
<p><b>See also</b> <a href="qvariantanimation.html#currentValue-prop">currentValue</a>,
<a href="qvariantanimation.html#startValue-prop">startValue</a>,
and <a href="qvariantanimation.html#endValue-prop">endValue</a>.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>